let applicationName = '/movie-api'
let url_mapping = {
  'getByHotComment': applicationName + '/movie/getByHotComment.do',
  'getByType': applicationName + '/movie/getByType.do',
  'getById': applicationName + '/movie/getById.do',

  'getByMovieId': applicationName + '/comment/getByMovieId.do',


}
String.prototype.format = function (args) {
  if (arguments.length > 0) {
    let result = this;
    if (arguments.length == 1 && typeof (args) == "object") {
      for (let key in args) {
        let reg = new RegExp("({" + key + "})", "g");
        result = result.replace(reg, args[key]);
      }
    } else {
      for (let i = 0; i < arguments.length; i++) {
        if (arguments[i] == undefined) {
          return "";
        } else {
          let reg = new RegExp("({[" + i + "]})", "g");
          result = result.replace(reg, arguments[i]);
        }
      }
    }
    return result;
  } else {
    return this;
  }
}

function get_query_variable(variable) {
  let query = window.location.search.substring(1);
  let vars = query.split("&");
  for (let i = 0; i < vars.length; i++) {
    let pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  return (false);
}